//
//  TwoVC.m
//  block
//
//  Created by yhj on 16/1/7.
//  Copyright © 2016年 QQ:1787354782. All rights reserved.
//

#import "TwoVC.h"
#import "Masonry.h"

@interface TwoVC ()

@property(nonatomic,copy)UITextField *textField;

@end

@implementation TwoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor yellowColor];
    self.title=@"B界面";
    
    _textField=[[UITextField alloc]init];
    _textField.placeholder=@"请输入想要的内容";
    [self.view addSubview:_textField];
    _textField.backgroundColor=[UIColor whiteColor];
    [_textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view).offset(10);
        make.right.mas_equalTo(self.view).offset(-10);
        make.top.mas_equalTo(self.view).offset(80);
        make.height.mas_equalTo(40);
    }];

    UIButton *btn=[[UIButton alloc]init];
    btn.backgroundColor=[UIColor blueColor];
    [btn setTitle:@"返回" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_textField.mas_bottom).offset(10*2);
        make.left.mas_equalTo(self.view).offset(100);
        make.width.mas_equalTo(90);
        make.height.mas_equalTo(50);
    }];
}

-(void)btnClick
{
    if (_delegate&&[_delegate respondsToSelector:@selector(passTextValue:)]) {
        [_delegate passTextValue:_textField.text];
    }
    [self.navigationController popViewControllerAnimated:YES];
}

@end
